import { axios } from '@/utils/request'

export const orderTypeDict = [
  { label: '会费', value: 'MEMBER_FEES' },
  { label: '解锁名片', value: 'UNLOCK_BUSINESS_CARD' },
  { label: '联系秘书处', value: 'SECRETARIAT' },
  { label: '解锁供需', value: 'UNLOCK_BUSINESS_OPPORTUNITIES' }
]

export const payModeDict = [
  { label: '线上支付', value: 'WECHAT_PAY' },
  { label: '转账', value: 'TRANSFER_ACCOUNTS' }
]

const api = {
  orderList: '/admin/mp/member-paymenrecord/pageList',
  orderDetail: '/admin/mp/member-paymenrecord/getById',
  updatePayMoney: '/admin/mp/member-paymenrecord/updatePayMoney',

  businessOrderList: '/admin/mp/app-user-order/pageList',
  businessOrderDetail: '/admin/mp/app-user-order/getByIdOrderDetail',
  accountList: '/admin/settleInfo/list',
  accountInfo: '/admin/settleInfo/info',

  getResourcesOrderList: '/mall/mp/resource/order/settleList',
  settleDetail: '/mall/mp/resource/order/settleDetail'
}

export default api

/**
 * 会费订单列表
 */
export function OrderList(params) {
  return axios({
    url: api.orderList,
    method: 'get',
    params
  })
}

/**
 * 会费订单详情
 */
export function OrderDetail(id) {
  return axios({
    url: api.orderDetail + `/${id}`,
    method: 'get'
  })
}

/**
 * 修改订单金额
 */
export function UpdatePayMoney(data) {
  return axios({
    url: api.updatePayMoney,
    method: 'post',
    data
  })
}

/**
 * 业务订单列表
 */
export function BusinessOrderList(data) {
  return axios({
    url: api.businessOrderList,
    method: 'post',
    params: { current: data.current, size: data.size },
    data
  })
}

/**
 * 业务订单详情
 */
export function BusinessOrderDetail(orderCode) {
  return axios({
    url: api.businessOrderDetail + `?orderCode=${orderCode}`,
    method: 'get'
  })
}

/**
 * 结算分润列表
 */
export function AccountList(orderCode) {
  return axios({
    url: api.accountList + `?orderCode=${orderCode}`,
    method: 'get'
  })
}

/**
 * 订单分润信息
 */
export function AccountInfo(orderCode) {
  return axios({
    url: api.accountInfo + `?orderCode=${orderCode}`,
    method: 'get'
  })
}

/**
 * 资源平台订单列表
 */
export function getResourcesOrderList(params) {
  return axios({
    url: api.getResourcesOrderList,
    method: 'get',
    params
  })
}

/**
 * 查询资源平台订单详情
 * @param {*} id
 * @returns
 */
export function settleDetail(id) {
  return axios({
    url: api.settleDetail + '/' + id,
    method: 'get'
  })
}

/**
 * 活动票种订单
 * @param {*} params
 * @returns
 */
export function getActivityTicketOrderPageList(params) {
  return axios({
    url: '/admin/mp/activity-ticket/order/pageList',
    method: 'get',
    params
  })
}

/**
 * 活动票种订单详情
 * @param {*} id
 * @returns
 */
export function getActivityTicketOrderDetail(id) {
  return axios({
    url: `admin/mp/activity-ticket/order/getById/${id}`,
    method: 'get'
  })
}
